<template>
	<div class="list-wrapper">
		<table class="list-table" border="0" cellspacing="0" cellpadding="0">
			<thead>
				<tr>
					<th>编号</th>
					<th>全称</th>
					<th>简称</th>
					<th>机构性质</th>
					<th>国家</th>
					<th>省份</th>
				</tr>
			</thead>
			<tbody>
				<tr v-for="item in list" :key="item.id" @click="detail(item.id)">
					<td>{{item.cnumber}}</td>
					<td class="name">{{item.name}}</td>
					<td>{{item.short_name}}</td>
					<td>{{item.scope}}</td>
					<td>{{item.country}}</td>
					<td>{{item.province}}</td>
				</tr>
			</tbody>
		</table>
		<div class="namtc-pagination">
			<el-pagination @current-change="handleCurrentChange" :current-page="page" :page-size="10" layout="total, prev, pager, next, jumper" :total="total">
			</el-pagination>
		</div>
		
	</div>
</template>

<script>
export default {
	data() {
		return {
			page: 1,
			total: 0,
			list: [],
			search: {}
		}
	},
	methods: {
		fetchData() {
			let data = this.search
			data.page = this.page
			this.apiPost('Customer/customerList', data).then(res => {
				this.list = res.list
				this.total = parseInt(res.total)
			})
		},

		handleCurrentChange(val) {
			this.page = val
			this.fetchData()
		},

		detail(id) {
			router.push('/customer/detail/' + id)
		}
	},
	created() {
		this.search = Lockr.get('customerSearch')
		this.fetchData()
	},
}
</script>

<style scoped>
	
</style>